import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'
import Home from '../views/Home'
import Welcome from '../views/Welcome'
import Users from '../components/users/users'
import UserPortrait from '../components/users/userPortrait'
import BookList from '../components/books/bookList'
import BookCate from '../components/books/bookCate'
import BookAudit from '../components/books/bookAudit'
import OrderList from '../components/orders/orderList'
import Statistics from '../components/orders/statistics'

Vue.use(VueRouter)

const routes = [
  { path: '/', redirect: '/login' },
  { path: '/login', component: Login },
  {
    path: '/home',
    component: Home,
    redirect: '/welcome',
    children: [
      { path: '/welcome', component: Welcome },
      { path: '/users', component: Users },
      { path: '/userPortrait', component: UserPortrait },
      { path: '/booklist', component: BookList },
      { path: '/bookcate', component: BookCate },
      { path: '/bookaudit', component: BookAudit },
      { path: '/orderlist', component: OrderList },
      { path: '/statistics', component: Statistics }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
